From 810d33a0c96af1ecd9844bb06611db0a4bcd5137 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 28 Sep 2005 18:03:20 +0100 Subject: [PATCH] This patch fixes a race between when the disable cpu is marked online and binding IPIs back to the CPU. In some cases, an IPI would be sent to CPU1 before it had allocated a new evtchn. Moving smp_resume() call before setting the cpu online fixes this race. This fixes bug #228 (http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=228). Signed-off-by: Ryan Harper --- .../arch/xen/i386/kernel/process.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c b/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c index ca08c3bd2e..058fd3797c 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c @@ -112,6 +112,10 @@ void xen_idle(void) #ifdef CONFIG_HOTPLUG_CPU #include +#ifdef CONFIG_SMP +extern void smp_suspend(void); +extern void smp_resume(void); +#endif /* We don't actually take CPU down, just spin without interrupts. */ static inline void play_dead(void) { @@ -120,6 +124,13 @@ static inline void play_dead(void) HYPERVISOR_yield(); __flush_tlb_all(); + /* + * Restore IPI/IRQ mappings before marking online to prevent + * race between pending interrupts and restoration of handler. + */ +#ifdef CONFIG_SMP + smp_resume(); +#endif cpu_set(smp_processor_id(), cpu_online_map); } #else @@ -135,10 +146,6 @@ static inline void play_dead(void) * low exit latency (ie sit in a loop waiting for * somebody to say that they'd like to reschedule) */ -#ifdef CONFIG_SMP -extern void smp_suspend(void); -extern void smp_resume(void); -#endif void cpu_idle (void) { int cpu = _smp_processor_id(); @@ -166,9 +173,6 @@ void cpu_idle (void) HYPERVISOR_vcpu_down(cpu); #endif play_dead(); -#ifdef CONFIG_SMP - smp_resume(); -#endif local_irq_enable(); } -- 2.30.2